package com.service.util;

import java.io.Serializable;

public class FunctionUtil implements Serializable {

	private static final long serialVersionUID = 1L;

	public String getDurationString(int seconds) {

		int hours = seconds / 3600;
		int minutes = (seconds % 3600) / 60;
		seconds = seconds % 60;

		return twoDigitString(hours) + ":" + twoDigitString(minutes) + ":"
				+ twoDigitString(seconds);
	}

	public String twoDigitString(int number) {

		if (number == 0) {
			return "00";
		}

		if (number / 10 == 0) {
			return "0" + number;
		}

		return String.valueOf(number);
	}
	
}
